security: fix token exposure, info disclosure, and path validation vulnerabilities#203
Open
Mr-Neutr0n wants to merge 1 commit intousestrix:mainfrom
Open
Conversation
## Security Fixes
### 1. Token Exposure Prevention (CWE-214)
- Tool server now reads auth token from TOOL_SERVER_TOKEN env var instead of CLI args
- Prevents token exposure in process listings (ps aux)
- CLI --token still works as fallback but env var is preferred
### 2. Health Endpoint Information Disclosure (CWE-200)
- Split /health into public and authenticated endpoints
- Public /health returns only {"status": "healthy"} for liveness probes
- New /health/detailed requires Bearer auth for internal state
### 3. Path Traversal Prevention (CWE-22)
- Added _validate_path_safety() to detect symlink escape attempts
- Blocks copying from sensitive system directories via symlinks
- Skips symlinks during directory traversal to prevent attacks
### 4. Port Allocation Race Condition (CWE-367)
- Added retry logic to _find_available_port()
- Uses SO_REUSEADDR for better port allocation
- Handles TOCTOU race conditions gracefully
### 5. TLS Verification Configuration
- Added STRIX_VERIFY_TLS env var to control TLS verification
- Defaults to false (required for pen testing proxy interception)
- Suppresses urllib3 warnings when disabled
- Documents security implications
## Tests
- Added 15 comprehensive security tests in tests/runtime/test_security.py
- All tests pass alongside existing 56 tests
Author
|
Hi team 👋 Just following up on this security PR. It addresses token exposure, info disclosure, and path validation vulnerabilities. Happy to make any changes if needed. Let me know if you have any questions! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Security audit and fixes for multiple vulnerabilities in the Strix runtime and tool server components.
Security Fixes
1. Token Exposure Prevention (CWE-214)
The tool server previously accepted authentication tokens via
--tokenCLI argument, which exposed tokens in process listings (ps aux).Fix: Token is now read from
TOOL_SERVER_TOKENenvironment variable. CLI argument remains as fallback but env var takes precedence.2. Health Endpoint Information Disclosure (CWE-200)
The
/healthendpoint exposed internal state including active agent IDs and count without authentication.Fix:
/healthnow returns only{"status": "healthy"}(for load balancer probes)/health/detailedendpoint requires Bearer token authentication3. Path Traversal Prevention (CWE-22)
_copy_local_directory_to_container()followed symlinks, enabling potential directory traversal attacks.Fix:
_validate_path_safety()to detect symlink escape attempts4. Port Allocation Race Condition (CWE-367)
_find_available_port()was vulnerable to TOCTOU race conditions.Fix: Added retry logic with
SO_REUSEADDRsocket option.5. TLS Verification Configuration
verify=Falsewas hardcoded with no documentation.Fix:
STRIX_VERIFY_TLSenvironment variablefalse(required for proxy interception in pen testing)Testing
tests/runtime/test_security.pyChecklist